package org.glut.wechat.moments.controller;

import org.glut.wechat.moments.domain.MomentsComment;
import org.glut.wechat.moments.service.MomentsCommentService;
import org.glut.wechat.moments.service.MomentsLikesService;
import org.glut.wechat.moments.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 朋友圈评论控制器
 */
@RestController
@RequestMapping("/likes")
@CrossOrigin
public class MomentsLikesController {

    @Autowired
    private MomentsLikesService momentsLikesService;

    @PostMapping("/likeMoment/{momentId}/{userId}")
    public Result likeMoment(@PathVariable Integer momentId,
                             @PathVariable Integer userId) {
        momentsLikesService.likeMoment(momentId,userId);
        return Result.ok();
    }


    @DeleteMapping("/unlikeMoment/{momentId}/{userId}")
    public Result unlikeMoment(@PathVariable Integer momentId,
                             @PathVariable Integer userId) {
        momentsLikesService.unlikeMoment(momentId,userId);
       return Result.ok();
    }


}
